package com.game.manager.controller;

import com.game.manager.params.UserRequest;
import com.game.manager.params.UserResponse;
import com.game.manager.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @ResponseBody
    @PostMapping("/register")
    public UserResponse register(@RequestBody UserRequest user) {
        return userService.register(user);
    }

    @ResponseBody
    @PostMapping("/login")
    public String login(@RequestBody UserRequest user) {
        return userService.login(user);
    }

    @ResponseBody
    @PostMapping("/info")
    public UserResponse getRole(@RequestBody String username) {
        return userService.getUserRole(username);
    }
}
